<%@include file="menu/util.jsp" %>
<%@page contentType="text/html; charset=iso-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <fmt:bundle basename="app">
    <head>
        <title><fmt:message key="login.title.tag" /></title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <jsp:include page="menu/header.jsp">
            <jsp:param name="v" value="login" />
        </jsp:include>




    <script type="text/javascript">
        $.validator.setDefaults({
            submitHandler: function() { 
                


       //event.preventDefault();
           var name = $('#name').attr('value');
           var description = $('#description').attr('value');


           if($('#<-----INSERT------>Id').attr('value') > 0){
               var id = +$('#<-----INSERT------>Id').attr('value');
               editName(id,name,description,priority,color);
               alert('edit')
            }else{
                  alert('insert')
               //insertName(name,description,priority,color);
            }

    //            $('#newAlert').submit()


    }
        });

        $().ready(function() {
	// validate the comment form when it is submitted
            $("#newAlert").validate();


         $("#alertId").change(function(){
            selectColorimetry($(this).val());
        });





           

        });
    </script>

    <c:set var="name" value=""/>
    <c:set var="description" value=""/>
    <c:set var="template" value=""/>

      <c:if test="${alert != null}" >
        <c:set var="name" value="${alert.name}"/>
        <c:set var="description" value="${alert.description}"/>
        <c:set var="template" value="${alert.template}"/>
    </c:if>



    </head>
    <body>
        <form id="newAlert" action="newAlert.do">
            <table>
                <tr>
                    <td>
                         <fmt:message key="forms.name" />
                    </td>
                    <td>
                        <input class="required" type="text" name="name" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                         <fmt:message key="forms.description" />
                    </td>
                    <td>
                        <input class="required" type="text" name="description" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                         <fmt:message key="forms.smtp" />
                    </td>
                    <td>
                        <input class="required" type="text" name="smtpServer" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                         <fmt:message key="forms.mail" />
                    </td>
                    <td>
                        <input class="email required" type="text" name="mail" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                         <fmt:message key="forms.password" />
                    </td>
                    <td>
                        <input class="" id="password" type="password" name="password" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                         <fmt:message key="forms.password.repeat" />
                    </td>
                    <td>
                        <input type="password" id="password2" name="password2" value="" />
                    </td>
                </tr>
                <%--
                <tr>
                    <td>
                         <fmt:message key="forms.framework" />
                    </td>
                    <td>
                        <select name="framework">
                            <c:forEach items="${frameworks}" var="framework">
                                <option value="${framework.idFramework}">${framework.name}</option>
                            </c:forEach>
                        </select>
                    </td>
            </tr>
                --%>
                <tr>
                    <td colspan="2">
                        <input id="send" type="submit" value="<fmt:message key='forms.send'/>" />
                    </td>
                </tr>
            </table>


        </form>
    </body>
    </fmt:bundle>
</html>













